<%@page import="java.sql.*" %>
<%@ page import="java.util.*"%>
<%@ page import="com.hline.kbcss.MyDriver"%>

<%
int id=Integer.parseInt(request.getParameter("id"));
String rpage=request.getParameter("fn");
String tn=null;
 Statement stmt=MyDriver.getConnection("READ");
 ResultSet rs=null;
 if(id<1000)
 {
  rs=stmt.executeQuery("select abuse from user where userid='"+id+"'");
   tn="user"; 
  }
 else if(id>1000&&id<10000)
 {
 rs=stmt.executeQuery("select abuse from faculty where userid='"+id+"'");
 tn="faculty";
 }
 else
 {
 rs=stmt.executeQuery("select abuse from hr where userid='"+id+"'");
 tn="hr";
 }
rs.next();
int abuses =rs.getInt(1)+1;
int i=stmt.executeUpdate("update "+tn+" set abuse="+abuses+" where userid='"+id+"'");
if(i!=1)
out.println("rated");
else
out.println("not rated");



response.sendRedirect(rpage);
%>





%>